import { createApp } from 'vue'
import App from './App.vue'
import router from './router/index'
import { store, key } from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import zhCn from 'element-plus/es/locale/lang/zh-cn.mjs'
import { createPinia } from 'pinia'

// 加载全局样式
import './styles/index.scss'

// 组件
import AppPagination from '@/components/Pagination/index.vue' // 分页器
import AppDialogForm from '@/components/DialogForm/index.vue' // 弹窗
import AppCard from '@/components/Card/index.vue' // 卡片(背景)
import AppIcon from '@/components/Icon/index.vue' // 图标

const app = createApp(App)
const pinia = createPinia()

app.use(router)
app.use(store, key)
app.use(ElementPlus, { size: 'small', zIndex: 3000, locale: zhCn })
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(pinia)
app.use(createPinia)

app.component('AppPagination', AppPagination)
app.component('AppDialogForm', AppDialogForm)
app.component('AppCard', AppCard)
app.component('AppIcon', AppIcon)

app.mount('#app')

// 前端微服务
// registerMicroApps([
//     {
//         name: 'vue-app', // app name registered
//         // entry: { scripts: ['//127.0.0.1:7001/setting/permission/admin'] },
//         entry: '//127.0.0.1:7001/setting/permission/admin',
//         container: '#container',
//         activeRule: '/app-vue',
//     },
// ])
// start()
